#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@File    : watermark.py
@Author  : Spring
@Time    : 2024/11/6 9:50
@Desc    : 水印添加工具类
"""
import time

from common.common import BusinessInput
from common.exception import WatermarkError
from watermark.water_mark.watermark_service import WatermarkService


class Watermark:

    @classmethod
    def struct_watermark(cls, business_input: BusinessInput, source_file_path: str, target_file_path: str):
        """
        结构化水印添加
        :param business_input: 用户水印输入对象
        :param source_file_path:  需要添加水印的文件文件路径
        :param target_file_path:  水印后的文件存放路径
        :return: 水印添加成功返回true 水印添加失败返回false
        """
        try:
            return WatermarkService.struct_watermark(business_input, source_file_path, target_file_path)
        except Exception as e:
            raise WatermarkError("结构化水印添加异常", e)

    @classmethod
    def un_struct_watermark(cls, business_input: BusinessInput, source_file_path: str, target_file_path: str):
        """
        非结构化水印添加
        :param business_input: 用户水印输入对象
        :param source_file_path:  需要添加水印的文件文件路径
        :param target_file_path:  水印后的文件存放路径
        :return:
        """
        try:
            return WatermarkService.un_struct_watermark(business_input, source_file_path, target_file_path)
        except Exception as e:
            raise WatermarkError("非结构化水印添加异常", e)

